import { createStore } from 'vuex'
// import book from './modules/book'
import getters from './getters'
import actions from './actions'

const files = require.context('./modules', false, /\.js$/)
const modules = {}

// 动态加载vuex
files.keys().forEach(key => {
  modules[key.replace(/(\.\/|\.js)/g, '')] = files(key).default
})

export default createStore({
  state: {},
  mutations: {},
  actions,
  getters,
  modules: modules
})
